34216b
@@ -33,6 +33,7 @@
import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -143,9 +144,25 @@
public class StartMojo extends AbstractSwarmMojo {
 
         return new SwarmExecutor()
                 .withModules(expandModules())
-                .withClassPathEntries(dependencies(false))
+                .withClassPathEntries(dependencies(false, artifact -> {
+                    if (artifact.getGroupId().equals("org.wildfly.swarm")) {
+                        return true;
+                    } else if (artifact.getArtifactId().equals("shrinkwrap-impl-base")) {
+                        return true;
+                    } else {
+                        List<String> depTrail = artifact.getDependencyTrail();
+                        if (depTrail != null && depTrail.size() > 0) {
+                            for (String dep : depTrail) {
+                                if (dep.startsWith("org.wildfly.swarm:")) {
+                                    return true;
+                                }
+                            }
+                        }
+                    }
+                    return false;
+                }))
                 .withProperty(BootstrapProperties.APP_PATH,
-                              Paths.get(this.projectBuildDir, finalName).toString())
+                        Paths.get(this.projectBuildDir, finalName).toString())
                 .withDefaultMainClass();
     }
 
@@ -155,7 +172,7 @@
public class StartMojo extends AbstractSwarmMojo {
 
         final SwarmExecutor executor = new SwarmExecutor()
                 .withModules(expandModules())
-                .withClassPathEntries(dependencies(true));
+                .withClassPathEntries(dependencies(true, a -> true));
 
         if (this.mainClass != null) {
             executor.withMainClass(this.mainClass);
@@ -166,7 +183,7 @@
public class StartMojo extends AbstractSwarmMojo {
         return executor;
     }
 
-    List<Path> dependencies(boolean includeProjectArtifact) {
+    List<Path> dependencies(boolean includeProjectArtifact, Predicate<Artifact> filter) {
 
         List<Path> elements = new ArrayList<>();
         Set<Artifact> artifacts = this.project.getArtifacts();
@@ -174,7 +191,10 @@
public class StartMojo extends AbstractSwarmMojo {
             if (each.getGroupId().equals("org.jboss.logmanager") && each.getArtifactId().equals("jboss-logmanager")) {
                 continue;
             }
-            elements.add(each.getFile().toPath());
+
+            if (filter.test(each)) {
+                elements.add(each.getFile().toPath());
+            }
         }
 
         if (includeProjectArtifact) {
